 package uk.co.mmscomputing.device.twain;
 
 public class TwainImageInfo
   implements TwainConstants
 {
   TwainSource source;
   byte[] buf = new byte[42];
 
   public TwainImageInfo(TwainSource paramTwainSource) {
     this.source = paramTwainSource;
   }
 
   public void get() throws TwainIOException {
     this.source.call(2, 257, 1, this.buf);
   }
   public double getXResolution() {
     return jtwain.getFIX32(this.buf, 0); } 
   public double getYResolution() { return jtwain.getFIX32(this.buf, 4); } 
   public int getWidth() { return jtwain.getINT32(this.buf, 8); } 
   public int getHeight() { return jtwain.getINT32(this.buf, 12); } 
   public int getSamplesPerPixel() { return jtwain.getINT16(this.buf, 16); } 
   public int getBitsPerSample(int paramInt) { return jtwain.getINT16(this.buf, 18 + paramInt * 2); } 
   public int getBitsPerPixel() { return jtwain.getINT16(this.buf, 34); } 
   public boolean getPlanar() { return jtwain.getINT16(this.buf, 36) != 0; } 
   public int getPixelType() { return jtwain.getINT16(this.buf, 38); } 
   public int getCompression() { return jtwain.getINT16(this.buf, 40); }
 
   public String toString() {
     String str = "TwainImageInfo\n";
     str = str + "\tx-resolution =" + getXResolution() + "\n";
     str = str + "\ty-resolution =" + getYResolution() + "\n";
     str = str + "\twidth =" + getWidth() + "\n";
     str = str + "\theight=" + getHeight() + "\n";
     int i = getSamplesPerPixel();
     str = str + "\tspp=" + i + "\n";
     for (int j = 0; j < i; j++) {
       str = str + "\tbps[" + j + "]=" + getBitsPerSample(j) + "\n";
     }
     str = str + "\tplanar=" + getPlanar() + "\n";
     str = str + "\tpixel type=" + getPixelType() + "\n";
     str = str + "\tcompression=" + getCompression() + "\n";
     return str;
   }
 }

